//
//  FirstTwoContenCell.m
//  DaJiHui
//
//  Created by Mac on 2017/9/29.
//  Copyright © 2017年 Hao. All rights reserved.
//

#import "FirstTwoContenCell.h"

@interface FirstTwoContenCell()

@property (nonatomic, strong) UILabel *contentLabel;

@end

@implementation FirstTwoContenCell

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(15);
        make.width.equalTo(@(ZTY_SCREEN_WIDTH-30));
        make.top.equalTo(self.mas_top).offset(15);
        [self.contentLabel sizeToFit];
    }];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initContentView];
    }
    return self;
}

- (void)initContentView
{
    [self addSubview:self.contentLabel];
}

- (UILabel *)contentLabel
{
    if (!_contentLabel) {
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.textColor = [UIColor grayColor];
        _contentLabel.font = [UIFont systemFontOfSize:14];
        _contentLabel.numberOfLines = 0;
    }
    return _contentLabel;
}

- (void)setContent:(NSString *)content
{
    
    NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[content dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
    self.contentLabel.attributedText = attrStr;
}

@end
